// $Id: memdriver.h,v 1.5 2006-10-30 17:50:24 nicolasw Exp $
#ifndef MEMDRIVER_H
#define MEMDRIVER_H

#include "heapmanager.h"

#include <stddef.h>
#include <stdbool.h>

typedef struct memdriver_s memdriver_s;

// Constructor and destructor
memdriver_s *md_create(heapmanager_s *hm);
void md_destroy(memdriver_s *this);

// Mutators
bool md_malloc(memdriver_s *this, void *rtag, void *vtag, size_t size);
void *md_free(memdriver_s *this, void *rtag); // returns its related vtag

// Selectors
unsigned int md_nmalloc(const memdriver_s *this);
unsigned int md_nfree(const memdriver_s *this);
size_t md_malloc_size_avg(const memdriver_s *this);
size_t md_malloc_size_max(const memdriver_s *this);
// cached versions
unsigned int md_nholes(memdriver_s *this);
unsigned int md_mean_hole(memdriver_s *this);
float md_int_frag(memdriver_s *this); // 1 - (alloc_mem/ used_mem)

#endif /* MEMDRIVER_H */
